package com.ruoyi.common.utils;



import com.ruoyi.common.utils.sign.Sign;

import java.util.Map;

/**
 * 维护用户token
 */
public class UserTokenManager {
	public static String generateToken(Long id,String tag) {
        return Sign.createToken(id,tag);
    }
    public static Map<String,Object> getUserId(String token) {
    	Map<String,Object> result = Sign.verifyTokenAndGetUserId(token);
		Object userId = result.get(Sign.CLAIM_USER_ID);
    	if(userId == null || Long.valueOf(String.valueOf(userId)) == 0){
    		return null;
    	}
        return result;
    }
}
